<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib uri="/WEB-INF/page-base.tld" prefix="w"%>
<style>
    .ui-queryBar{
        padding: 4px;
        height: 100px !important;
    }
    .Divlabel{
        display: inline-block;
        width: 230px;
        padding: 7px;
        float: left;
    }
    .uplable{
        display: inline-block;
        padding: 0 5px;
        font-size: 14px;
        color: #505050;
        line-height: 28px;
    }
</style>
<form method="post" action="">
    <div class="ui-queryBar " border="false" data-options="doSize:true" style="padding:4px;height:60px;">
        <input type="hidden" class="userid" name="name" value="<w:write bind="bean.ID"/>">
        <div class="Divlabel">
            <label class="uplable">用户名：</label>
            <span><w:write bind="bean.username"/></span>
        </div>
        <div class="Divlabel">
            <label class="uplable">当前积分：</label>
            <input type="text" class="current" value="<w:write bind="bean.integral"/>" disabled="disabled" style="width: 100px;border: none;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >
            <%--<span class="current">10089</span>--%>
        </div>
        <div class="Divlabel">
            <label class="uplable">修改数量：</label>
            <input type="text"  class="modifyNum" style="width: 100px;" oninput="value=value.match(/^-?[0-9]\d*$/)||value.match(/-?/);integratotla();">
        </div>
        <div class="Divlabel">
            <label class="uplable">修改后积分：</label>
            <input type="text" class="modify" disabled="disabled" style="width: 100px;border: none;" onkeyup="this.value=this.value.replace(/\D/g,'');" onafterpaste="this.value=this.value.replace(/\D/g,'')">
            <%--<span class="modify"></span>--%>
        </div>
        <p style="color: #999;text-align: center;">输入正数代表增加，输入负数代表减少</p>
    </div>
    <div style="text-align: center;padding-top: 16px;">
        <a href="javascript:;" class="easyui-linkbutton marginR8" onclick="alterConfirm();">确定</a>
        <a href="javascript:;" id="cancel" class="easyui-linkbutton marginR8" onclick="$w.closeCurrWin()" >取消</a>
    </div>
    <script>
        /**
         * 输入框输入修改数量后触发事件
         * @returns {boolean}
         */
       function integratotla() {
           var current = $(".current").val();
           var modifyNum = $(".modifyNum").val();
           var modify = parseInt(current) + parseInt(modifyNum);
           if (modifyNum == "" || isNaN(modifyNum)){
               return false;
           }else{
               $(".modify").val(parseInt(modify));
           }
       }
        var pedit_saveing = false;
        function alterConfirm(){

           var data = {};
            data["bean.ID"] = $(".userid").val();
           data["bean.alterintegral"] = $(".modify").val();

            $w.doUrl(ctx + "/integral/IntegralPage@update.page", data, function (ret) {
                $.messager.progress('close');
                if (ret.state == 'ok') {
                    window.parent.$w.correctMsg("修改保存成功");
                    $w.closeCurrWin("ok");


                } else {
                    pedit_saveing = false
                    window.parent.$w.alertMsg(ret.state);
                }
            });
        }

    </script>
</form>
